<script setup>
import { ref, computed } from 'vue'
import TimeTable from './components/TimeTable.vue'
import User from './components/User.vue'
import Note from './components/Note.vue'
const routes = {
  '/': TimeTable,
  '/User': User,
  '/Note': Note
}
const currentPath = ref(window.location.hash)
window.addEventListener('hashchange', () => {
  currentPath.value = window.location.hash
})
const currentView = computed(() => {
  return routes[currentPath.value.slice(1) || '/']
})
</script>

<template>
  <div class="iot_wrap">
    <div class="iot_main">
      <!-- 可切换 -->
      <component :is="currentView" />
    </div>
    <!-- 底部tab -->
    <div class="iot_footer">
      <div class="iot_tab">
        <img src="../src/assets/table.svg">
        <a href="#/">课程表</a>
      </div>
      <div class="iot_tab">
        <img src="../src/assets/note.svg">
        <a href="#/Note">记事本</a>
      </div>
      <div class="iot_tab">
        <img src="../src/assets/my.svg">
        <a href="#/User">我的</a>
      </div>
    </div>
  </div>
</template>

<style scoped>
.iot_wrap {
  width: 100%;
  height: 100vh;
  overflow-y: scroll;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: start;
  align-items: center;
}
.iot_main{
  width: 100%;
}
.iot_footer {
  display: flex;
  justify-content: space-around;
  align-items: center;
  position: fixed;
  top: 91vh;
  width: 100%;
  height: 9vh;
  background-color: hsla(160, 100%, 37%, 1);
}

.iot_tab {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  width: 20%;
  height: 85%;
  /* background-color: #CEDF9F; */
}
.iot_tab>img{
  width: 80%;
  height: 50%;
}
.iot_tab>a{
  /* color: #1E2A5E; */
  display: block;
  text-align: center;
}
</style>
